﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml; // TEMP
using System.Xml.Serialization; // TEMP
using System.Text; // TEMP
using Polls;

namespace NosoiFigthersWeb.PollDesigner {
	public partial class Editor : System.Web.UI.MasterPage {
		protected void Page_Load(object sender, EventArgs e) {
			title.Text = (Session["poll"] as Poll).Title;
			description.Text = (Session["poll"] as Poll).Description;
		}
		protected void Properties_Click(object sender, EventArgs e) {
			Response.Redirect("Properties.aspx");
		}
		protected void Elements_Click(object sender, EventArgs e) {
			Response.Redirect("Elements.aspx");
		}
		protected void Preview_Click(object sender, EventArgs e) {
			Response.Redirect("Preview.aspx");
		}
		protected void Save_Click(object sender, EventArgs e) {
			// TODO
			/*XmlSerializer xs = new XmlSerializer(typeof(Poll));
			XmlTextWriter xtw = new XmlTextWriter("Poll1.xml", Encoding.UTF8);
			xs.Serialize(xtw, Session["poll"] as Poll);
			xtw.Close();*/
		}
		protected void Delete_Click(object sender, EventArgs e) {
			// TODO
			Session["poll"] = null;
			Response.Redirect("../Default.aspx");
		}
	}
}